package cn.com.tt.flink.sql.engine.pojo.sql;

import lombok.Data;
import org.apache.flink.table.api.bridge.java.StreamTableEnvironment;

@Data
public abstract class AbstractBmFlinkSql {
    protected String sqlStatement;
    protected StreamTableEnvironment tableEnv;

    public AbstractBmFlinkSql(String sqlStatement, StreamTableEnvironment tableEnv) {
        this.sqlStatement = sqlStatement;
        this.tableEnv = tableEnv;
    }

    public void process() throws Exception {
        try {
            innerProcess();
        } catch (Exception e) {
            throw new Exception("执行sql出错：" + sqlStatement, e);
        }
    }

    protected abstract void innerProcess();
}
